<div class="row-fluid">
    <div class="span12">
        <div class="page-header">
            <h1>
                Round : Add
            </h1>
        </div>
    </div>
</div>
<div class="row-fluid">
    <form action="{$site_url}admin/round/add.html" method="post" id="control-add">
        <fieldset class="well">
            <div class="alert alert-error" {if="! $error_show"}style="display:none;"{/if}>
                <a class="close" data-dismiss="alert" href="#">x</a>
                <h4 class="alert-heading">Error!</h4>
                {$error_msg}
            </div>
            
            <div class="control-group well">
                <label class="control-label" for="post_check">Date</label>
                <input type="hidden" name="post_check" value="1" />
                <input type="hidden" name="question_id_list" value="{$questions_list}" />
                <input type="hidden" name="prize_id_list" value="{$prizes_list}" />
                <div class="controls">
                    <input type="text" name="round_date" class="datepicker" value="{function="date('d-m-Y')"}" />
                </div>
            </div>
            
            <div class="control-group well">
                <label class="control-label" for="input01">Time 1 :</label>
                <div class="controls">
                    <select id="select01" name="period_time[1]">
                        
                        <option value="1">00:00 - 00:59</option>
                        <option value="2">01:00 - 01:59</option>
                        <option value="3">02:00 - 02:59</option>
                        <option value="4">03:00 - 03:59</option>
                        <option value="5">04:00 - 04:59</option>
                        <option value="6">05:00 - 05:59</option>
                        <option value="7">06:00 - 06:59</option>
                        <option value="8">07:00 - 07:59</option>
                        <option value="9">08:00 - 08:59</option>
                        <option value="10">09:00 - 09:59</option>
                        <option value="11">10:00 - 10:59</option>
                        <option value="12">11:00 - 11:59</option>
                        <option value="13">12:00 - 12:59</option>
                        <option value="14">13:00 - 13:59</option>
                        <option value="15">14:00 - 14:59</option>
                        <option value="16">15:00 - 15:59</option>
                        <option value="17" selected="selected">16:00 - 16:59</option>
                        <option value="18">17:00 - 17:59</option>
                        <option value="19">18:00 - 18:59</option>
                        <option value="20">19:00 - 19:59</option>
                        <option value="21">20:00 - 20:59</option>
                        <option value="22">21:00 - 21:59</option>
                        <option value="23">22:00 - 22:59</option>
                        <option value="24">23:00 - 23:59</option>
                    </select>
                    <select id="select01" name="prize_id[1]">
                        <option>Prize</option>
                        {loop="prizes"}
                            <option value="{$value.id}">{$value.id} - {$value.remark} </option>
                        {/loop}
                    </select>
                    <select id="select01" name="question_id[1]">
                        <option value="0">Question</option>
                        {loop="questions"}
                            <option value="{$value.id}">{$value.id} - {$value.remark}</option>
                        {/loop}
                    </select>
                </div>
                
                <label class="control-label" for="input01">Time 2 :</label>
                <div class="controls">
                    <select id="select01" name="period_time[2]">
                        
                        <option value="1">00:00 - 00:59</option>
                        <option value="2">01:00 - 01:59</option>
                        <option value="3">02:00 - 02:59</option>
                        <option value="4">03:00 - 03:59</option>
                        <option value="5">04:00 - 04:59</option>
                        <option value="6">05:00 - 05:59</option>
                        <option value="7">06:00 - 06:59</option>
                        <option value="8">07:00 - 07:59</option>
                        <option value="9">08:00 - 08:59</option>
                        <option value="10">09:00 - 09:59</option>
                        <option value="11">10:00 - 10:59</option>
                        <option value="12">11:00 - 11:59</option>
                        <option value="13">12:00 - 12:59</option>
                        <option value="14">13:00 - 13:59</option>
                        <option value="15">14:00 - 14:59</option>
                        <option value="16">15:00 - 15:59</option>
                        <option value="17">16:00 - 16:59</option>
                        <option value="18" selected="selected">17:00 - 17:59</option>
                        <option value="19">18:00 - 18:59</option>
                        <option value="20">19:00 - 19:59</option>
                        <option value="21">20:00 - 20:59</option>
                        <option value="22">21:00 - 21:59</option>
                        <option value="23">22:00 - 22:59</option>
                        <option value="24">23:00 - 23:59</option>
                    </select>
                    <select id="select01" name="prize_id[2]">
                        <option>Prize</option>
                        {loop="prizes"}
                            <option value="{$value.id}">{$value.id} - {$value.remark} </option>
                        {/loop}
                    </select>
                    <select id="select01" name="question_id[2]">
                        <option value="0">Question</option>
                        {loop="questions"}
                            <option value="{$value.id}">{$value.id} - {$value.remark}</option>
                        {/loop}
                    </select>
                </div>
                
                <label class="control-label" for="input01">Time 3 :</label>
                <div class="controls">
                    <select id="select01" name="period_time[3]">
                        
                        <option value="1">00:00 - 00:59</option>
                        <option value="2">01:00 - 01:59</option>
                        <option value="3">02:00 - 02:59</option>
                        <option value="4">03:00 - 03:59</option>
                        <option value="5">04:00 - 04:59</option>
                        <option value="6">05:00 - 05:59</option>
                        <option value="7">06:00 - 06:59</option>
                        <option value="8">07:00 - 07:59</option>
                        <option value="9">08:00 - 08:59</option>
                        <option value="10">09:00 - 09:59</option>
                        <option value="11">10:00 - 10:59</option>
                        <option value="12">11:00 - 11:59</option>
                        <option value="13">12:00 - 12:59</option>
                        <option value="14">13:00 - 13:59</option>
                        <option value="15">14:00 - 14:59</option>
                        <option value="16">15:00 - 15:59</option>
                        <option value="17">16:00 - 16:59</option>
                        <option value="18">17:00 - 17:59</option>
                        <option value="19" selected="selected">18:00 - 18:59</option>
                        <option value="20">19:00 - 19:59</option>
                        <option value="21">20:00 - 20:59</option>
                        <option value="22">21:00 - 21:59</option>
                        <option value="23">22:00 - 22:59</option>
                        <option value="24">23:00 - 23:59</option>
                    </select>
                    <select id="select01" name="prize_id[3]">
                        <option>Prize</option>
                        {loop="prizes"}
                            <option value="{$value.id}">{$value.id} - {$value.remark} </option>
                        {/loop}
                    </select>
                    <select id="select01" name="question_id[3]">
                        <option value="0">Question</option>
                        {loop="questions"}
                            <option value="{$value.id}">{$value.id} - {$value.remark}</option>
                        {/loop}
                    </select>
                </div>
                
                <label class="control-label" for="input01">Time 4 :</label>
                <div class="controls">
                    <select id="select01" name="period_time[4]">
                        
                        <option value="1">00:00 - 00:59</option>
                        <option value="2">01:00 - 01:59</option>
                        <option value="3">02:00 - 02:59</option>
                        <option value="4">03:00 - 03:59</option>
                        <option value="5">04:00 - 04:59</option>
                        <option value="6">05:00 - 05:59</option>
                        <option value="7">06:00 - 06:59</option>
                        <option value="8">07:00 - 07:59</option>
                        <option value="9">08:00 - 08:59</option>
                        <option value="10">09:00 - 09:59</option>
                        <option value="11">10:00 - 10:59</option>
                        <option value="12">11:00 - 11:59</option>
                        <option value="13">12:00 - 12:59</option>
                        <option value="14">13:00 - 13:59</option>
                        <option value="15">14:00 - 14:59</option>
                        <option value="16">15:00 - 15:59</option>
                        <option value="17">16:00 - 16:59</option>
                        <option value="18">17:00 - 17:59</option>
                        <option value="19">18:00 - 18:59</option>
                        <option value="20" selected="selected">19:00 - 19:59</option>
                        <option value="21">20:00 - 20:59</option>
                        <option value="22">21:00 - 21:59</option>
                        <option value="23">22:00 - 22:59</option>
                        <option value="24">23:00 - 23:59</option>
                    </select>
                    <select id="select01" name="prize_id[4]">
                        <option>Prize</option>
                        {loop="prizes"}
                            <option value="{$value.id}">{$value.id} - {$value.remark} </option>
                        {/loop}
                    </select>
                    <select id="select01" name="question_id[4]">
                        <option value="0">Question</option>
                        {loop="questions"}
                            <option value="{$value.id}">{$value.id} - {$value.remark}</option>
                        {/loop}
                    </select>
                </div>
                
                <label class="control-label" for="input01">Time 5 :</label>
                <div class="controls">
                    <select id="select01" name="period_time[5]">
                        
                        <option value="1">00:00 - 00:59</option>
                        <option value="2">01:00 - 01:59</option>
                        <option value="3">02:00 - 02:59</option>
                        <option value="4">03:00 - 03:59</option>
                        <option value="5">04:00 - 04:59</option>
                        <option value="6">05:00 - 05:59</option>
                        <option value="7">06:00 - 06:59</option>
                        <option value="8">07:00 - 07:59</option>
                        <option value="9">08:00 - 08:59</option>
                        <option value="10">09:00 - 09:59</option>
                        <option value="11">10:00 - 10:59</option>
                        <option value="12">11:00 - 11:59</option>
                        <option value="13">12:00 - 12:59</option>
                        <option value="14">13:00 - 13:59</option>
                        <option value="15">14:00 - 14:59</option>
                        <option value="16">15:00 - 15:59</option>
                        <option value="17">16:00 - 16:59</option>
                        <option value="18">17:00 - 17:59</option>
                        <option value="19">18:00 - 18:59</option>
                        <option value="20">19:00 - 19:59</option>
                        <option value="21" selected="selected">20:00 - 20:59</option>
                        <option value="22">21:00 - 21:59</option>
                        <option value="23">22:00 - 22:59</option>
                        <option value="24">23:00 - 23:59</option>
                    </select>
                    <select id="select01" name="prize_id[5]">
                        <option>Prize</option>
                        {loop="prizes"}
                            <option value="{$value.id}">{$value.id} - {$value.remark} </option>
                        {/loop}
                    </select>
                    <select id="select01" name="question_id[5]">
                        <option value="0">Question</option>
                        {loop="questions"}
                            <option value="{$value.id}">{$value.id} - {$value.remark}</option>
                        {/loop}
                    </select>
                </div>
                
                <label class="control-label" for="input01">Time 6 :</label>
                <div class="controls">
                    <select id="select01" name="period_time[6]">
                        
                        <option value="1">00:00 - 00:59</option>
                        <option value="2">01:00 - 01:59</option>
                        <option value="3">02:00 - 02:59</option>
                        <option value="4">03:00 - 03:59</option>
                        <option value="5">04:00 - 04:59</option>
                        <option value="6">05:00 - 05:59</option>
                        <option value="7">06:00 - 06:59</option>
                        <option value="8">07:00 - 07:59</option>
                        <option value="9">08:00 - 08:59</option>
                        <option value="10">09:00 - 09:59</option>
                        <option value="11">10:00 - 10:59</option>
                        <option value="12">11:00 - 11:59</option>
                        <option value="13">12:00 - 12:59</option>
                        <option value="14">13:00 - 13:59</option>
                        <option value="15">14:00 - 14:59</option>
                        <option value="16">15:00 - 15:59</option>
                        <option value="17">16:00 - 16:59</option>
                        <option value="18">17:00 - 17:59</option>
                        <option value="19">18:00 - 18:59</option>
                        <option value="20">19:00 - 19:59</option>
                        <option value="21">20:00 - 20:59</option>
                        <option value="22" selected="selected">21:00 - 21:59</option>
                        <option value="23">22:00 - 22:59</option>
                        <option value="24">23:00 - 23:59</option>
                    </select>
                    <select id="select01" name="prize_id[6]">
                        <option>Prize</option>
                        {loop="prizes"}
                            <option value="{$value.id}">{$value.id} - {$value.remark} </option>
                        {/loop}
                    </select>
                    <select id="select01" name="question_id[6]">
                        <option value="0">Question</option>
                        {loop="questions"}
                            <option value="{$value.id}">{$value.id} - {$value.remark}</option>
                        {/loop}
                    </select>
                </div>
                
                <label class="control-label" for="input01">Time 7 :</label>
                <div class="controls">
                    <select id="select01" name="period_time[7]">
                        
                        <option value="1">00:00 - 00:59</option>
                        <option value="2">01:00 - 01:59</option>
                        <option value="3">02:00 - 02:59</option>
                        <option value="4">03:00 - 03:59</option>
                        <option value="5">04:00 - 04:59</option>
                        <option value="6">05:00 - 05:59</option>
                        <option value="7">06:00 - 06:59</option>
                        <option value="8">07:00 - 07:59</option>
                        <option value="9">08:00 - 08:59</option>
                        <option value="10">09:00 - 09:59</option>
                        <option value="11">10:00 - 10:59</option>
                        <option value="12">11:00 - 11:59</option>
                        <option value="13">12:00 - 12:59</option>
                        <option value="14">13:00 - 13:59</option>
                        <option value="15">14:00 - 14:59</option>
                        <option value="16">15:00 - 15:59</option>
                        <option value="17">16:00 - 16:59</option>
                        <option value="18">17:00 - 17:59</option>
                        <option value="19">18:00 - 18:59</option>
                        <option value="20">19:00 - 19:59</option>
                        <option value="21">20:00 - 20:59</option>
                        <option value="22">21:00 - 21:59</option>
                        <option value="23" selected="selected">22:00 - 22:59</option>
                        <option value="24">23:00 - 23:59</option>
                    </select>
                    <select id="select01" name="prize_id[7]">
                        <option>Prize</option>
                        {loop="prizes"}
                            <option value="{$value.id}">{$value.id} - {$value.remark} </option>
                        {/loop}
                    </select>
                    <select id="select01" name="question_id[7]">
                        <option value="0">Question</option>
                        {loop="questions"}
                            <option value="{$value.id}">{$value.id} - {$value.remark}</option>
                        {/loop}
                    </select>
                </div>
                
                <label class="control-label" for="input01">Time 8 :</label>
                <div class="controls">
                    <select id="select01" name="period_time[8]">
                        
                        <option value="1">00:00 - 00:59</option>
                        <option value="2">01:00 - 01:59</option>
                        <option value="3">02:00 - 02:59</option>
                        <option value="4">03:00 - 03:59</option>
                        <option value="5">04:00 - 04:59</option>
                        <option value="6">05:00 - 05:59</option>
                        <option value="7">06:00 - 06:59</option>
                        <option value="8">07:00 - 07:59</option>
                        <option value="9">08:00 - 08:59</option>
                        <option value="10">09:00 - 09:59</option>
                        <option value="11">10:00 - 10:59</option>
                        <option value="12">11:00 - 11:59</option>
                        <option value="13">12:00 - 12:59</option>
                        <option value="14">13:00 - 13:59</option>
                        <option value="15">14:00 - 14:59</option>
                        <option value="16">15:00 - 15:59</option>
                        <option value="17">16:00 - 16:59</option>
                        <option value="18">17:00 - 17:59</option>
                        <option value="19">18:00 - 18:59</option>
                        <option value="20">19:00 - 19:59</option>
                        <option value="21">20:00 - 20:59</option>
                        <option value="22">21:00 - 21:59</option>
                        <option value="23">22:00 - 22:59</option>
                        <option value="24" selected="selected">23:00 - 23:59</option>
                    </select>
                    <select id="select01" name="prize_id[8]">
                        <option>Prize</option>
                        {loop="prizes"}
                            <option value="{$value.id}">{$value.id} - {$value.remark} </option>
                        {/loop}
                    </select>
                    <select id="select01" name="question_id[8]">
                        <option value="0">Question</option>
                        {loop="questions"}
                            <option value="{$value.id}">{$value.id} - {$value.remark}</option>
                        {/loop}
                    </select>
                </div>
            </div>
            
            <div class="form-actions">
                <button type="submit" class="btn btn-primary">Save</button>
                <button class="btn">Cancel</button>
            </div>
        </fieldset>
    </form>
</div>
<link rel="stylesheet" href="js/datepicker/css/datepicker.css" />
<script type="text/javascript" src="js/datepicker/js/bootstrap-datepicker.js"></script>
<script type="text/javascript">
    $(function() {
        $('.datepicker').datepicker({format 	: 	'dd-mm-yyyy'})
    });
    
    $(function() {
        $('#control-add').submit(function(e) {
            e.preventDefault();
            $(this).ajaxSubmit({
                dataType     : 'json',
                beforeSubmit : beforeRequest,
                success      : afterRequest
            });
        });
    });
        
    function beforeRequest() {
    
    }
    
    function afterRequest(resp) {
        if (resp.status == true) {
            //$('#control-add').submit();
            window.location.href = '{$site_url}/admin/round';
        } else {
            setModal('Error!', resp.message);
        }
    }
</script>